// pages/showjoiner/showjoiner.js
const app = getApp()

Page({

  /**
   * 页面的初始数据
   */
  data: {
    urlLists:null,

    allnumber:0,

    lid:0,
    page:0,

    more:true
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this
    // console.log(options.lid);
    this.setData({
      lid : options.lid,
      allnumber: options.number
    })
    
    // this.getLIst(options.lid , this.data.page)
    wx.request({
      url: app.globalData.url + 'lotterys/get_avatar_list',
      data: {
        lid:options.lid,
        page:0
      },
      method: 'POSt',
      success: (res)=>{
        console.log(res);
        
        that.setData({
          urlLists:res.data.data,
          page:that.data.page + 1
        })
      },
      fail: ()=>{}
    });
  },

  more:function(){
    this.getLIst(this.data.lid , this.data.page)
  },

  getLIst:function(id,page){
    var that = this
    var urlLists = that.data.urlLists

    wx.request({
      url: app.globalData.url + 'lotterys/get_avatar_list',
      data: {
        lid:id,
        page:page
      },
      method: 'POSt',
      success: (res)=>{
        console.log(res);
        var list = res.data.data
        if(list.length == 40){
          that.setData({
            urlLists:urlLists.concat(list),
            page:page + 1
          })
        }else{
          that.setData({
            urlLists:urlLists.concat(list),
            page:page + 1,
            more:false
          })
        }
      },
      fail: ()=>{}
    });
  }

})